package com.lfl.spring6.bean3;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class UserTest {

    //    @Value("lfl")
    private String name;
    //    @Value("18")
    private int age;

//    @Value("yxh")
//    public void setName(String name) {
//        this.name = name;
//    }
//
//    @Value("19")
//    public void setAge(int age) {
//        this.age = age;
//    }

    public UserTest(@Value("lyx") String name, @Value("20") int age) {
        this.name = name;
        this.age = age;
    }

    @Override
    public String toString() {
        return "User{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}
